/* eslint-disable import/no-anonymous-default-export */
import { askListPage, askUpdate } from '../services/feedback'

export default {
    state: {
        data: [],
        updateData: []
    },
    effects: {
        async askListPage(params) {
            const response = await askListPage(params)

            if (response.code === 200) {
                this.saveAskListPage({
                    data: response.data
                })
            }
        },
        async askUpdate(params) {
            const response = await askUpdate(params)

            if (response.code === 200) {
                this.saveAskUpdate({
                    updateData: response.data
                })
            }
        },
    },
    reducers: {
        saveAskListPage(state, paylode) {
            return {
                ...state,
                ...paylode
            }
        },
        saveAskUpdate(state, paylode) {
            return {
                ...state,
                ...paylode
            }
        },
    }
}